Fix URL validation and handling in URLUtil#12800
Fix URL validation and handling in URLUtil#12800sfahaddev wants to merge 42 commits intoJabRef:mainfrom
Conversation
33a8fbf to
e060945
Compare
src/main/java/org/jabref/logic/importer/util/FileFieldParser.java
Outdated
Show resolved
Hide resolved
Signed-off-by: whatisfahad <fahadzamansid@gmail.com>
05de4cd to
4ea9e06
Compare
Signed-off-by: whatisfahad <fahadzamansid@gmail.com>
04b92fe to
eaf63e3
Compare
…bref into fix-for-issue-12186
ac5292b to
3cee13c
Compare
jablib/src/main/java/org/jabref/logic/importer/util/FileFieldParser.java
Outdated
Show resolved
Hide resolved
|
Something seems to be messed up in protocol handling - especially if other protocols than http(s) are used: |
jablib/src/main/java/org/jabref/logic/importer/util/FileFieldParser.java
Outdated
Show resolved
Hide resolved
|
@trag-bot didn't find any issues in the code! ✅✨ |
|
Your code currently does not meet JabRef's code guidelines. We use Checkstyle to identify issues. You can see which checks are failing by locating the box "Some checks were not successful" on the pull request page. To see the test output, locate "Tests / Checkstyle (pull_request)" and click on it. In case of issues with the import order, double check that you activated Auto Import. You can trigger fixing imports by pressing Ctrl+Alt+O to trigger Optimize Imports. Please carefully follow the setup guide for the codestyle. Afterwards, please run checkstyle locally and fix the issues, commit, and push. |
| @ParameterizedTest | ||
| @CsvSource({ | ||
| // Relative URLs (should default to HTTPS) | ||
| "www.example.com, https://www.example.com", |
There was a problem hiding this comment.
I don't get this - maybe it should be reversed: expected is first, input is second
There was a problem hiding this comment.
ChatGPT and Co-Pilot always generate this ordering; I don't know why ^^
There was a problem hiding this comment.
Hi @koppor, I really appreciate the learning experience and your feedback throughout this process. Since this was my first open-source contribution, I gave it my best shot but I realize I couldn’t meet the expectations fully. I’ve decided to step back and will be closing my PR. Thank you again for the opportunity and guidance.
Closes #12186
Describe the changes you have made here: what, where, why, ...
URLUtilclass.isURLandcreatemethods inURLUtiland added/modified tests inURLUtilTest.www.example.com) were not being handled correctly, and to ensure proper validation of URLs with various protocols (e.g.,http://,https://,ftp://,file://).Changes:
isURLMethod:MalformedURLExceptionandIllegalArgumentException).URISyntaxExceptionto correctly identify invalid URLs.createMethod:http://only to URLs without a protocol (e.g.,www.example.com→http://www.example.com).ftp://example.com,file:///path/to/file) are not modified.Tests:
file:///path/to/file→file:/path/to/file).Mandatory checks
CHANGELOG.mddescribed in a way that is understandable for the average user (if change is visible to the user)